

export class Avatar {
    url: string;
    filename: string;
    thumbnailUrl: any;
    contentLength: number;
    contentType: string;
    imageHeight: number;
    imageWidth: number;
    firstImage: any;
}

export class UserInfo {
    memberId: string;
    syPayUserNo: any;
    syUserId: string;
    userName: string;
    nickName: string;
    cellphone: string;
    avatar: Avatar;
    gender: number;
    hobby: any;
    giveLikeNumber: number;
    commentNumber: number;
    releaseNumber: number;
    messageNumber: number;
    likeNumber: number;
    collectNumber: number;
    medalImg: any;
    modelImg: any;
    ifPassword: number;
    realName: any;
    relation: number;
    fansNumber: number = 0;
    focusNumber: number = 0;
    friendNumber: number = 0;
    status: number;
    equityName: any;

    /**
     * 返回用户头像
     * @returns
     */
    getAvatarUrl():string{
        if (!this.avatar || this.avatar === undefined) {
            return ''
        }
        return this.avatar.url
    }
    /**
     * 格式化粉丝数量
     * @returns 格式化后的字符串
     */
    formatFansCount(): string {
        if (this.fansNumber >= 100000000) { // 1亿及以上
            const yi = this.fansNumber / 100000000;
            return `${yi.toFixed(1)}亿`;
        } else if (this.fansNumber >= 10000) { // 1万及以上
            const wan = this.fansNumber / 10000;
            return `${wan.toFixed(1)}万`;
        } else if (this.fansNumber >= 1000) { // 1千及以上
            const k = this.fansNumber / 1000;
            return `${k.toFixed(1)}k`;
        } else { // 1000以下
            return this.fansNumber.toString();
        }
    }

    /**
     * 格式化朋友数量
     * @returns 格式化后的字符串
     */
    formatFriendsCount(): string {
        if (this.friendNumber >= 100000000) { // 1亿及以上
            const yi = this.friendNumber / 100000000;
            return `${yi.toFixed(1)}亿`;
        } else if (this.friendNumber >= 10000) { // 1万及以上
            const wan = this.friendNumber / 10000;
            return `${wan.toFixed(1)}万`;
        } else if (this.friendNumber >= 1000) { // 1千及以上
            const k = this.friendNumber / 1000;
            return `${k.toFixed(1)}k`;
        } else { // 1000以下
            return this.friendNumber.toString();
        }
    }

    /**
     * 格式化关注数量
     * @returns 格式化后的字符串
     */
    formatFocusCount(): string {
        if (this.focusNumber >= 100000000) { // 1亿及以上
            const yi = this.focusNumber / 100000000;
            return `${yi.toFixed(1)}亿`;
        } else if (this.focusNumber >= 10000) { // 1万及以上
            const wan = this.focusNumber / 10000;
            return `${wan.toFixed(1)}万`;
        } else if (this.focusNumber >= 1000) { // 1千及以上
            const k = this.focusNumber / 1000;
            return `${k.toFixed(1)}k`;
        } else { // 1000以下
            return this.focusNumber.toString();
        }
    }


}